﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.ApplicationServices;
using System.Web.Mvc;
using EF.Container;
using EFmodel;
using IEFbll;

namespace EFdemo.Controllers
{
    public class RoleController : Controller
    {
        private IRoleService RoleService = Container.Resolve<IRoleService>();
        // GET: Role
        public ActionResult Index()
        {
            return View();
        }
        [HttpPost]
        public ActionResult GetRoleList()
        {
            var data = RoleService.GetModels(p => true).ToList();
            return Json(data);
        }

        public ActionResult ChangeName(Role role)
        {
            if( RoleService.Update( role ) )
            {
                return Redirect( "Index" );
            }
            else
            {
                return Content( "no" );
            }
        }
    }
}